#pragma once
#ifndef __FACTORIES_H__
#define __FACTORIES_H__

#include <boost/shared_ptr.hpp>
#include <map>
#include <string>

class c_scene_node_factory;
typedef boost::shared_ptr<c_scene_node_factory> scene_node_factory_ptr;

class c_factory_manager
{
public:
    void register_scene_node_factory(std::string& name, scene_node_factory_ptr factory_ptr) 
    {
        assert(factory_ptr);
        m_snfm.insert(std::pair<std::string, scene_node_factory_ptr>(name, factory_ptr)); 
    }

    scene_node_factory_ptr& get_factory(std::string& name)
    {
        scene_node_factory_map_t::iterator it;
        it = m_snfm.find(name); 
        assert(it != m_snfm.end());
        return it->second; 
    }
    
private:
    typedef std::map<std::string, scene_node_factory_ptr> scene_node_factory_map_t;
    scene_node_factory_map_t m_snfm;
};

//////////////////////////////////////////////////////////////////////////

extern c_factory_manager& get_factory_manager();



#endif